home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gtlayout.lha
/
Source
/
LT_CreateHandle.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-09-09
|
16KB
|
623 lines
/*
** GadTools layout toolkit
**
** Copyright © 1993-1998 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=4
*/
#ifndef _GTLAYOUT_GLOBAL_H
#include "gtlayout_global.h"
#endif
/*****************************************************************************/
#include <exec/memory.h>
#include <clib/keymap_protos.h>
#include <pragmas/keymap_pragmas.h>
#include <stdarg.h>
/*****************************************************************************/
#include "Assert.h"
LayoutHandle * LIBENT
LT_CreateHandle(REG(a0) struct Screen *Screen,REG(a1) struct TextAttr *Font)
{
return(LT_CreateHandleTags(Screen,
LH_Font,Font,
TAG_DONE));
}
/*****************************************************************************/
LayoutHandle *
LT_CreateHandleTags(struct Screen *Screen,...)
{
LayoutHandle *Handle;
va_list VarArgs;
va_start(VarArgs,Screen);
Handle = LT_CreateHandleTagList(Screen,(struct TagItem *)VarArgs);
va_end(VarArgs);
return(Handle);
}
/*****************************************************************************/
/****** gtlayout.library/LT_CreateHandleTagList ******************************************
*
* NAME
* LT_CreateHandleTagList -- Allocate auxilary data required by LT_New()
* and LT_BuildA().
*
* SYNOPSIS
* Handle = LT_CreateHandleTagList(Screen,Tags);
* D0 A0 A1
*
* LayoutHandle *LT_CreateHandleTagList(struct Screen *,struct TagItem *);
*
* Handle = LT_CreateHandleTags(Screen,...);
*
* struct LayoutHandle *LT_CreateHandleTags(struct Screen *,...);
*
* FUNCTION
* Memory is allocated, tables are set up and data is collected
* on a screen a user interface is to be opened on. This
* involves calculating the screen font parameters.
*
* INPUTS
* Screen - Pointer to the screen the user interface is to
* use. Passing NULL will cause the default public
* screen to be used.
*
* NOTE: if NULL is passed the default public screen
* will stay locked until LT_DeleteHandle()
* is called.
*
* Tags - Tag values to control certain aspects of the
* user interface created.
*
*
* Valid tags include:
*
* LAHN_AutoActivate (BOOL) - Set to TRUE if you want the interface
* to always keep a string gadget active if possible. Hitting
* the return key will then cause the next following string
* gadget to get activated, either cycling through all the
* string gadgets available or stopping at the next string
* gadget to have the LAST_LastGadget attribute set.
* Default: TRUE
*
* LAHN_RawKeyFilter (BOOL) - Discard unprocessed IDCMP_RAWKEY
* events. (V13)
* Default: TRUE
*
* LAHN_UserData (APTR) - Store user specific data in the
* LayoutHandle->UserData entry.
*
* NOTE: This tag requires gtlayout.library v9 and the
* corresponding entry in the LayoutHandle exists
* only under gtlayout.library v9 and up. *NEVER*
* write to this entry, use LT_SetAttributes()
* instead.
*
* LAHN_LocaleHook (struct Hook *) - The hook to call when
* locale string IDs are to be mapped to strings. The
* hook function is called with the following parameters:
*
* String = HookFunc(struct Hook *Hook,struct LayoutHandle *Handle,
* D0 A0 A2
* LONG ID)
* A1
*
* The function is to look up the string associated with the ID
* passed in and return the string.
* Default: no locale hook
*
* LAHN_TextAttr (struct TTextAttr *) - The text font to use when
* creating the gadgets and objects.
* Default: Screen->Font
*
* LAHN_CloningPermitted (BOOL) - If a window will not fit onto the
* screen the user interface is intended for, the layout engine
* will scale the interface data down while stepping down in
* font size. If all this fails, the engine will open a custom
* screen for the window; this process is called "cloning".
* The LAHN_CloningPermitted tag controls whether the engine will
* actually try to open the custom screen or just return NULL
* when LT_Build fails.
* Default: TRUE
*
* LAHN_EditHook (struct Hook *) - You can specify a default string
* gadget editing hook to be used for all following string
* gadgets. Your hook should obey the same rules that apply
* to hooks passed via GTST_EditHook/GTIN_EditHook.
* Default: NULL
*
* LAHN_ExactClone (BOOL) - This tag works in conjunction with the
* LAHN_CloningPermitted tag. By default the layout engine will
* try to replicate only the basic characteristics of the
* screen the window was intended to open on. This may result
* in a screen which uses less colours than the original
* screen. You can force the engine to make an almost exact
* clone of the original screen by passing the LAHN_ExactClone
* tag with a value of TRUE.
* Default: FALSE
*
* LAHN_MenuGlyphs (BOOL) - This tag will make the layout engine
* fill in the AmigaGlyph and CheckGlyph entries of the
* LayoutHandle if running under Kickstart 3.0 or higher.
* The corresponding images will be scaled to fit the actual
* screen aspect ratio values and can later be used for
* menu layout.
* Default: FALSE
*
* LAHN_Parent (struct Window *) - You can pass a pointer to the
* parent window of the window you intend to open using
* the user interface layout engine. The new window will
* open inside the boundaries of the parent window. If the
* size does not fit, it will be opened centered over the
* parent window.
* Default: NULL
*
* LAHN_BlockParent (BOOL) - This tag works in conjunction with the
* LAHN_Parent tag. If in effect, will block the parent window
* via LT_LockWindow until the new window is closed, after
* which the parent window is unlocked again.
* Default: FALSE
*
* LAHN_SimpleClone (BOOL) - This tag works in conjunction with the
* LAHN_CloningPermitted tag. It will make the layout engine
* forget most information about the original screen the
* user interface was intended for. In short, it will open a
* simple default screen for the interface.
* Default: FALSE
*
* LAHN_ExitFlush (BOOL) - When the LayoutHandle is finally disposed
* of with LT_DeleteHandle() all variables maintained by the
* input handling code will be flushed. For example, if you
* would use the LA_STRPTR tag for STRING_KIND objects the
* last string gadget contents would be copied into the buffer
* pointed to by LA_STRPTR. If you do not want to use this
* feature, disable it with "LAHN_ExitFlush,FALSE". (V9)
* Default: TRUE
*
* LAHN_NoKeys (BOOL) - Use TRUE to tell the library not to pick
* keyboard shortcuts all on its own. This works like calling
* LT_New() for all objects with "LA_NoKey,TRUE,". (V26)
*
* LAHN_PubScreen (struct Screen *) - Pointer to public screen
* window is to open on. Must be locked and open until you call
* LT_Built().
*
* LAHN_PubScreenName (STRPTR) - Name of public screen to open window
* on. The library will try to lock the named screen as soon as
* you call LT_CreateHandle.
*
* LAHN_PubScreenFallBack (BOOL) - If the named public screen cannot
* be found and you ask for it, the library will lock the default
* public screen (default: TRUE).
*
* LAHN_TopGroupType (LONG) - Request that after creating the layout
* handle, a layout group should be added to it. This can be
* either a vertical or a horizontal group. You specify the type
* using VERTICAL_KIND or HORIZONTAL_KIND (default: don't add
* any group). (V45)
*
* RESULT
* Handle - Pointer to a LayoutHandle structure.
*
******************************************************************************
*
*/
LayoutHandle * LIBENT
LT_CreateHandleTagList(REG(a0) struct Screen *Screen,REG(a1) struct TagItem *TagList)
{
LayoutHandle * Handle;
struct Screen * PubScreen;
APTR Pool;
ULONG WA_ScreenTag;
BOOL UnlockThePubScreen;
LONG TopGroupType = -1;
#ifdef DO_PICKSHORTCUTS
{
ObtainSemaphore(<P_KeySemaphore);
if(!LTP_Keys[1])
{
UBYTE m